﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdBrEdge : OdBrEntity
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdBrEdge(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdBrEdge_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdBrEdge obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdBrEdge()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdBrEdge(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public bool getVertex2(OdBrVertex vertex2)
		{
			bool result = GlobalsPINVOKE.OdBrEdge_getVertex2(this.swigCPtr, OdBrVertex.getCPtr(vertex2));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool getVertex1(OdBrVertex vertex1)
		{
			bool result = GlobalsPINVOKE.OdBrEdge_getVertex1(this.swigCPtr, OdBrVertex.getCPtr(vertex1));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGe.EntityId getCurveType()
		{
			OdGe.EntityId result = (OdGe.EntityId)GlobalsPINVOKE.OdBrEdge_getCurveType(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeCurve3d getCurve()
		{
			OdGeCurve3d result = new OdGeCurve3d(GlobalsPINVOKE.OdBrEdge_getCurve__SWIG_0(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrErrorStatus getCurve(OdGeCurve3d pCurve)
		{
			OdBrErrorStatus result = (OdBrErrorStatus)GlobalsPINVOKE.OdBrEdge_getCurve__SWIG_1(this.swigCPtr, pCurve);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool getCurveAsNurb(OdGeNurbCurve3d nurb)
		{
			bool result = GlobalsPINVOKE.OdBrEdge_getCurveAsNurb(this.swigCPtr, OdGeNurbCurve3d.getCPtr(nurb));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool getOrientToCurve()
		{
			bool result = GlobalsPINVOKE.OdBrEdge_getOrientToCurve(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool getColor(OdCmEntityColor color)
		{
			bool result = GlobalsPINVOKE.OdBrEdge_getColor(this.swigCPtr, OdCmEntityColor.getCPtr(color));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrEdge() : this(GlobalsPINVOKE.new_OdBrEdge(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
